Skip to content

id-pg: Postgres-over-HTTP (PostgREST) query translator with allowlist (#13760) - #14363

Merged
developing-today-fleet[bot] merged 1 commit into
mainfrom
queue/23263-pghttp-translator
Nov 24, 2026
Merged

developing-today-fleet[bot] merged 1 commit into
mainfrom
queue/23263-pghttp-translator

Conversation

@developing-today-fleet

@developing-today-fleet developing-today-fleet Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Implements #13760 — the query translator slice of the Postgres-over-HTTP adapter design (#5805, doc/2026-11-23T20-55-00Z_design_id5805_postgres_http_adapter/).

What lands

New crate pkgs/id/crates/id-pg (§3 of the design):

  • Query object (id: design: ID query language/shape v1 (from #5675) #5816 data shape): one collection, declared projection, conjunctive filters over the closed operator set (eq/neq/lt/lte/gt/gte/in/is.null), ordering on declared keys, keyset pagination, capped limit. The type can also express the refused shapes (writes, /rpc/*, discovery, raw SQL, boolean trees, embeds, offset pagination, counts) so refusal is a translator decision the tests can exercise.
  • Allowlist: per-collection schema/relation, declared columns with filterable/orderable flags, declared unique key, row cap (default 500). Constructed directly in the design-specified shapes; registration/owner config (id: impl: Postgres HTTP adapter registration and owner config (from #5805) #13758) will build these after its checks.
  • Translator: pure; validates in a fixed precedence order and either emits the PostgREST request (GET /<relation>, Accept-Profile, select/filter/order/limit params) or refuses with the §3.2 stable feature name (join_unsupported, boolean_unsupported, text_pattern_unsupported, offset_unsupported, count_unsupported, rpc_unsupported, write_unsupported, discovery_unsupported, field_unsupported, sql_unsupported, limit_exceeded; unknown relation collapses to not_available). Keyset cursors are emitted as the adapter-generated lexicographic or=(...) over the effective ordering (declared keys + unique-key tiebreak), so the pagination key is total by construction. Refusal bodies depend only on code + feature name, so undeclared and withheld columns are byte-identical (§6.2).

Tests (§10 verification plan)

cargo test -p id-pg — 22 passed (run on the laptop in the pkgs/id nix dev shell; the Actions exec runner cannot check out this repo and has no nix/Rust toolchain for pkgs/id, and repo CI runs on main only):

  • 5 unit tests (translation rendering: star expansion, tiebreak append, keyset or string, in.(...) quoting, is.null).
  • 15 model tests over the §3.2 refusal table, incl. the undeclared-vs-withheld identical-body test and the default-500 cap.
  • 2 property tests (proptest, 128 cases + regression seed): every generated supported query translates using only declared columns/operators with a total pagination key, deterministically; undeclared filter columns are always field_unsupported. The seed in tests/property.proptest-regressions is a real catch from this run: it exposed an over-strong assertion in the first test draft (a unique-key column already ordered by keeps its position rather than being appended twice) — translator behaviour was correct, the test now states totality as set containment + no duplicates.

Clippy: no deny-level lints; cargo fmt applied.

Book (book-live-update)

The ID book's crate counts were re-derived from Cargo.toml — 19 crates / 20 members / 17 default packages — and corrected in the layout, crates, architecture, and shape chapters (they said 16/17/15, already stale by two crates before this change). Roster entries added for id-pg, plus the missing id-client and id-tui-shell rows/entries written from their own Cargo.toml descriptions so counts and rosters agree. The pub mod total in the crates chapter (247) was re-counted as ^pub mod lines across the 19 lib.rs files.

Not in scope

Typed mapping (§5.1, #13761), error mapping/collapse of source errors (§6, #13762), read paths/transport (§5.2–5.3, #13763), conformance fixtures (#13764), registration checks (§4, #13758).

Note: workspace CI on main is currently red for an unrelated pre-existing reason — #14315 (id-store compile break from the 2026-11-24 grouped cargo bump; fix in flight as queue task 23352). This crate does not depend on id-store; its tests are green standalone as recorded above.

Refs #13760

{
  "direct_parent": null,
  "links": [],
  "lineage": {
    "design": null,
    "roadmap_item": null,
    "priority": null
  },
  "pm_meta": 1,
  "provenance": {
    "queue_id": null,
    "scheduled_start": null,
    "picked_up_at": null,
    "work_started_at": null,
    "created_at": "2026-11-24T13:31:17Z",
    "session_id": null,
    "lane": null,
    "host": "htch-runtime",
    "worktree": null,
    "model": null,
    "lane_start_issues": [],
    "workspace_ref": null,
    "auth_subject": "archer",
    "stamped_by": "fleet 0.1.0 (native)"
  }
}

Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…#13760)

New crate pkgs/id/crates/id-pg implementing section 3 of the #5805
design: the data-shaped query object, the owner collection allowlist,
and the pure translator to a PostgREST request — or a refusal by the
section 3.2 stable feature name, always before any network call.
Keyset pagination is generated as the lexicographic or-group over the
effective ordering (declared keys plus the unique-key tiebreak), so
the pagination key is total by construction.

Tests (design section 10): property tests over the query object
(allowlist conformance, total pagination key, determinism) and model
tests over the section 3.2 refusal table, including byte-identical
bodies for undeclared vs withheld columns (section 6.2).
cargo test -p id-pg: 22 passed.

Book (book-live-update): ID book crate counts re-derived from
Cargo.toml (19 crates / 20 members / 17 default packages) in the
layout, crates, architecture, and shape chapters; id-pg roster
entries added, plus the missing id-client and id-tui-shell rows from
their own Cargo.toml descriptions.

Refs #13760
@coderabbitai

coderabbitai Bot commented Nov 24, 2026

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e440c296-0992-4432-9dff-263392dd9757

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@developing-today-fleet
developing-today-fleet Bot merged commit b7cd916 into main Nov 24, 2026
2 checks passed
@developing-today-fleet
developing-today-fleet Bot deleted the queue/23263-pghttp-translator branch November 24, 2026 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant